;(function(){
var role = require("./role");
var BusCon = require("../../core/bus/_con");
var UserCon = require("../../core/user/_con");
var GoodsCon = require("../../core/goods/_con");
var AchCon = require("../../core/ach/_con");
var EvalCon = require("../../core/eval/_con");
var CommentCon = require("../../core/comment/_con");
var db = require("../../core/db/index");
var config = require("../../core/_include/config");
var ResponObj = require("../_include/responObj");

module.exports = {
	prefix:"/bus/eval",
	get:{
		"/":function () {
			var bus  = role.getBus(this);
			var query = this.request.query;
			var evaluations = bus.getEvaluations(query.num,query.page);
			this.body = ResponObj("json",evaluations);
		},
		"/with_page_info":function () {
			var bus  = role.getBus(this);
			var query = this.request.query;
			var info = bus.getEvaluations_PageInfo(query.num,query.page);
			this.body = ResponObj("json",info);
		}
	},
	post:{
		"/as_comment":function () {
			var bus  = role.getBus(this);
			var body = this.request.body;
			var reply_id = body.reply_id;
			var content = body.content;
			if (!(reply_id&& content)) {
				throw "参数错误"
			}
			var comment_id = bus.addComment(reply_id,content/*,isAny*/)//商家不可匿名
			this.body = ResponObj("json",CommentCon.get(comment_id).getDetail())
		}
	}
}	
}());